﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using IDAL.A;
using Model.A;

namespace DAL.A
{
    /// <summary>
    /// 保留不用
    /// </summary>
    public class AFYGEPlugin:BaseRepository_DT<AFYGEPluginInfo>,IAFYGEPlugin
    {
        #region 静态变量定义
        private const string PARM_AFYGEPLUGIN_PCNASN = "@PCBASN";
        private const string PARM_AFYGEPLUGIN_RECORDTIME = "";
        private const string PARM_AFYGEPLUGIN_USERID = "@UserID";
        private const string PARM_AFYGEPLUGIN_OSCILLATORSN = "@OscillatorSN";
        private const string PARM_AFYGEPLUGIN_POWERSUPPLYSN = "@PowerSupplySN";
        private const string PARM_AFYGEPLUGIN_RECEIVERSN = "@ReceiverSN";
        #endregion

        #region 数据检索部分
        public IList<AFYGEPluginInfo> LoadEntities()
        {
            return null;
        }

        public AFYGEPluginInfo LoadEntity<T1>(T1 sn)
        {
            return null;
        }

        public IList<AFYGEPluginInfo> AFYGEPlugin_GetbySN(string sn)
        {
            SqlParameter parm = GetParameter();
            parm.Value = sn;
            return ExcuteSqlToGetEntities("AFYGEPlugin_selectbySN", parm);
        }

        public IList<AFYGEPluginInfo> AFYGEPlugin_GetbyDT(DateTime dt1, DateTime dt2)
        {
            SqlParameter[] parms = GetDTParameters();
            parms[0].Value = dt1;
            parms[1].Value = dt2;
            return ExcuteSqlToGetEntities("AFYGEPlugin_selectbyDT", parms);
        }
        #endregion

        #region 重写基类方法
        public override AFYGEPluginInfo GetEntityRecord(SqlDataReader rdr)
        {
            AFYGEPluginInfo entity = new AFYGEPluginInfo(rdr.GetValue(0).ToString(),rdr.GetDateTime(1),rdr.GetValue(2).ToString()
                ,rdr.GetValue(3).ToString(),rdr.GetValue(4).ToString(),rdr.GetValue(5).ToString());
            return entity;
        }

        public override AFYGEPluginInfo GetEntityRecord()
        {
            AFYGEPluginInfo entity = new AFYGEPluginInfo();
            return entity;
        }

        public override SqlParameter GetParameter()
        {
            SqlParameter parm = new SqlParameter(PARM_AFYGEPLUGIN_PCNASN, SqlDbType.NVarChar, 50);
            return parm;
        }

        public override SqlParameter[] GetParameters()
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter(PARM_AFYGEPLUGIN_PCNASN,SqlDbType.NVarChar,50),
                new SqlParameter(PARM_AFYGEPLUGIN_USERID,SqlDbType.NVarChar,10),
                new SqlParameter(PARM_AFYGEPLUGIN_OSCILLATORSN,SqlDbType.NVarChar,50),
                new SqlParameter(PARM_AFYGEPLUGIN_POWERSUPPLYSN,SqlDbType.NVarChar,50),
                new SqlParameter(PARM_AFYGEPLUGIN_RECEIVERSN,SqlDbType.NVarChar,50)
            };            
            return parms;
        }

        public override void SetParameters(AFYGEPluginInfo Entity, params SqlParameter[] Parms)
        {
            Parms[0].Value = Entity.PCBASN;
            Parms[1].Value = Entity.UserID;
            Parms[2].Value = Entity.OscillatorSN;
            Parms[3].Value = Entity.PowerSupplySN;
            Parms[4].Value = Entity.ReceiverSN;
        }
        #endregion
    }
}
